<script language="JavaScript" type="text/javascript">
<!--
function chkFormular() {
	if(document.post.usedfor.value == "") {
		alert("%enter_usage%");
		document.post.usedfor.focus();
   		return false;
	}
	
	if(document.post.day.value == "") {
		alert("%enter_date%");
		document.post.day.focus();
   		return false;
	}
	
	if(document.post.month.value == "") {
		alert("%enter_date%");
		document.post.month.focus();
   		return false;
	}
	
	if(document.post.year.value == "") {
		alert("%enter_date%");
		document.post.year.focus();
   		return false;
	}
	
	if(document.post.euro.value == "" || document.post.euro.value == "0.00") {
		alert("%enter_total_costs%");
		document.post.euro.focus();
   		return false;
	}
	
	if(document.post.usereuro.value == "" || document.post.usereuro.value == "0.00") {
		alert("%enter_costs_member%");
		document.post.usereuro.focus();
   		return false;
	}
	
}

function berechnen() {
	var anz = document.post.anz.value;
	var total = document.post.euro.value;
	
	var user = total/anz;
	var rounduser = Math.round(user);
	
	document.post.usereuro.value = rounduser;
	document.post.calculation.value = rounduser + " EUR  (" + total + "/" + anz + "=" + user + ")";
	
	document.post.usereuro.focus();
	return;
}
-->
</script>

<form name="post" method="post" action="cash_box.php" onsubmit="return chkFormular()">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="$border">
  <tr>
    <td class="title" colspan="2" align="center" bgcolor="$bghead">%new_usage%</td>
  </tr>
  <tr><td bgcolor="$pagebg" colspan="2"></td></tr>
  <tr bgcolor="$bg1">
        <td align="right">%squad%:</td>
        <td><select name="squad">$squads</select></td>
      </tr>
      <tr bgcolor="$bg2">
        <td align="right">%usage%:</td>
        <td><input name="usedfor" type="text" id="usedfor" value="$usage" size="55" /></td>
      </tr>
      <tr bgcolor="$bg1">
        <td align="right" valign="top">%info%:</td>
        <td><textarea name="info" cols="50" rows="7">$info</textarea></td>
      </tr>
      <tr bgcolor="$bg2">
        <td align="right" valign="top">%bank_account%:</td>
        <td><textarea name="konto" cols="50" rows="4">$bank_account</textarea></td>
      </tr>
      <tr bgcolor="$bg1">
        <td align="right">%pay_until%:</td>
        <td><input type="text" name="day" size="2" value="$day" />
        .
        <input type="text" name="month" size="2" value="$month" />
        .
        <input type="text" name="year" size="4" value="$year" /> %ddmmyyyy%</td>
      </tr>
      <tr bgcolor="$bg2">
        <td align="right">%total_costs%:</td>
        <td><input type="text" dir="rtl" name="euro" size="8" value="$ds[totalcosts]" /> &#8364;</td>
      </tr>
      <tr bgcolor="$bg1">
        <td align="right">%costs_member%:</td>
        <td><input type="hidden" name="anz" value="$anz" />
        <input type="text" dir="rtl" name="usereuro" size="8" value="$ds[usercosts]" /> &#8364;
        <input type="button" name="calculate" value="%calculate%" onclick="berechnen()" />
        <input name="calculation" type="text" class="input" size="50" value="" /></td>
      </tr>
      <tr bgcolor="$bg2">
        <td><input type="hidden" name="id" value="$id" /></td>
        <td><input type="submit" name="saveedit" value="%submit%" /></td>
      </tr>
</table>
</form>